package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpTimeClockTimecardPageUtil extends SeleniumPageUtil {
	public final static By TCTC_SPAN_HEADER = By.id("ctl44_lblHdr");
	public final static By TCTC_TD_PAY_PERIOD_AND_USER = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[1]");
	public final static By TCTC_SELECT_PAY_PERIOD = By.id("ctl44_cboPeriod");
	public final static By TCTC_SELECT_USER = By.id("ctl44_cboUser");
	public final static By TCTC_B_LEGEND = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/b");
	public final static By TCTC_IMG_EDIT = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/img[1]");
	public final static By TCTC_IMG_APPROVE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/img[2]");
	public final static By TCTC_TH_WORK_CODE = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[1]");
	public final static By TCTC_TH_WEEK_1 = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[1]/th[2]");
	// the day of week 1
	public final static By TCTC_TH_WEEK_1_MON = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[2]");
	public final static By TCTC_TH_WEEK_1_TUE = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[3]");
	public final static By TCTC_TH_WEEK_1_WED = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[4]");
	public final static By TCTC_TH_WEEK_1_THUR = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[5]");
	public final static By TCTC_TH_WEEK_1_FRI = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[6]");
	public final static By TCTC_TH_WEEK_1_SAT = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[7]");
	public final static By TCTC_TH_WEEK_1_SUN = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[8]");
	public final static By TCTC_TH_WEEK_1_TOT = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[9]");
	
	
	public final static By TCTC_TH_WEEK_2 = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[1]/th[3]");
	// the day of week 2
	public final static By TCTC_TH_WEEK_2_MON = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[11]");
	public final static By TCTC_TH_WEEK_2_TUE = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[12]");
	public final static By TCTC_TH_WEEK_2_WED = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[13]");
	public final static By TCTC_TH_WEEK_2_THUR = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[14]");
	public final static By TCTC_TH_WEEK_2_FRI = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[15]");
	public final static By TCTC_TH_WEEK_2_SAT = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[16]");
	public final static By TCTC_TH_WEEK_2_SUN = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[17]");
	public final static By TCTC_TH_WEEK_2_TOT = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[2]/th[18]");
	public final static By TCTC_TH_TOTALS = By.xpath("//*[@id='ctl44_lblTimeCardOut']/table/tbody/tr[1]/th[4]");
	
	// total data
	public final static By TCTC_SPAN_DATA = By.id("ctl44_lblTimeCardOut");
	
	// Drill Down Details
	public final static By TCTC_SPAN_DRILL_DOWN_DETAILS = By.id("ctl44_lblTransactionDrillDown");
	
	// edit overtime
	public final static By TCTC_INPUT_EDIT_OVER_TIME = By.id("ctl44_txtOvertimeEdit");
	
	public final static By TCTC_TEXTAREA_EDIT_REASON = By.id("ctl44_txtOvertimeEditReason");
	public final static By TCTC_IMG_EDIT_SAVE = By.id("ctl44_overtimeForm_imgSave");
	
	// save reject
	public final static By TCTC_IMG_REJECT_SAVE = By.id("ctl44_overtimeRejectForm_imgSave");
	public final static By TCTC_TEXTAREA_REJECT_REASON = By.id("ctl44_txtOvertimeRejectReason");
	
	public static void enterTimeClockTimecardPage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterTimeClockTimecardPage();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				TCTC_SELECT_PAY_PERIOD, TCTC_SELECT_USER, TCTC_IMG_EDIT, TCTC_IMG_APPROVE
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(TCTC_SELECT_PAY_PERIOD));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(TCTC_SELECT_USER));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(TCTC_IMG_EDIT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(TCTC_IMG_APPROVE));
	}
}
